// Copyright (c) Microsoft Corporation.  All rights reserved.

#include "stdafx.h"
#include "DXGISurface.h"

using namespace Microsoft::WindowsAPICodePack::DirectX::DXGI;

SurfaceDescription^ Surface::GetDescription()
{
    SurfaceDescription^ desc = gcnew SurfaceDescription();
    CommonUtils::VerifyResult(GetInterface<IDXGISurface>()->GetDesc(desc->nativeObject.Get()));

    return desc;
}

MappedRect^ Surface::Map(MapOption flags)
{
    MappedRect^ rect = gcnew MappedRect();
    CommonUtils::VerifyResult(GetInterface<IDXGISurface>()->Map(rect->nativeObject.Get(), static_cast<UINT>(flags)));
    
    return rect;
}

void Surface::Unmap()
{
    CommonUtils::VerifyResult(GetInterface<IDXGISurface>()->Unmap());
}

